<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.Map" %>
<%@page import="java.util.List" %>
<%@page import="java.util.Iterator" %>
<%@page import="java.math.BigDecimal" %>
<div class="path">
    <span>Preferencies</span>
</div>
<div id="page">
<%
List<Map<String,Object>> carrets = (List<Map<String,Object>>) request.getAttribute("carrets");
Iterator<Map<String,Object>> it = carrets.iterator();
Map<String,Object> carret;
if (carrets != null && !carrets.isEmpty()) { %>
    <div class="carrets">
    <% while(it.hasNext()) {
        carret = it.next();
        %>
        <% if(session.getAttribute("idCarret") != null && (Integer)session.getAttribute("idCarret") == ((BigDecimal)carret.get("id_ticket")).intValue()) { %>
        <div class="carretT">
            <%=carret.get("data").toString().substring(0, 10) %> Carret amb <%=carret.get("items") %> productes
        </div>
        <% } else { %>
        <div class="carret" value="<%=carret.get("id_ticket") %>">
            <%=carret.get("data").toString().substring(0, 10) %> Carret amb <%=carret.get("items") %> productes
            <div class="mirar">Mirar</div>
            <% if(((BigDecimal)carret.get("pend_fact")).intValue() == 1) { %>
            <div class="activar">Activar</div>
            <% } %>
        </div>
        <% } %>
    <% } %>
    </div>
    <div id="detalls">
        <%@include file="detallsPref.jsp" %>
    </div>
<% } else { %>
    <div class="noCar">No hi ha carrets</div>
<% } %>
</div>